package com.xwm93up.basic.enumtips;

import java.util.HashMap;
import java.util.Map;

/**
 * @Description: desc
 * @Author: xwm93up
 * @Since: 2021/11/27 15:48
 */
public class RoleFactory {
    static Map<String, RoleOperation> roleOperationMap = new HashMap<>();

    // 在静态代码块中把初始化工作全部做完
    static {
        roleOperationMap.put("ROLE_ROOT_ADMIN", new RootAdminRole("ROLE_ROOT_ADMIN"));
        roleOperationMap.put("ROLE_ORDER_ADMIN", new RootAdminRole("ROLE_ORDER_ADMIN"));
        roleOperationMap.put("ROLE_NORMAL", new RootAdminRole("ROLE_NORMAL"));
    }

    public static RoleOperation getOp(String roleName) {
        return roleOperationMap.get(roleName);
    }
}
